package com.own.demo.lwf.utils.javaUtils;

import java.util.Collection;
import java.util.UUID;

/**
 * @Author liwenfeng
 * @Description 集合判空工具类
 * @Date 2023/07/07/16:21
 * @Version 1.0
 */
public class CommonUtil {
    /**
     * 判断集合为空
     * @param collection
     * @return
     */
    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty() || collection.size() <= 0;
    }

    /**
     * 判断集合非空
     * @param collection
     * @return
     */
    public static boolean isNotEmpty(Collection<?> collection) {
        return !isEmpty(collection);
    }

    /**
     * 随机生成UUID
     * @return
     */
    public static String getUUID(){
        UUID uuid = UUID.randomUUID();
        return uuid.toString().replaceAll("-","");
    }
}
